package org.mozhu.learning.algo.stack;

/**
 * 基于JDK Stack 实现的Stack，方便编写单元测试，来对比其他实现的功能
 */
public class StackOfJDKStack<E> implements Stack<E> {

    private java.util.Stack<E> stack = new java.util.Stack<>();

    @Override
    public int size() {
        return stack.size();
    }

    @Override
    public boolean isEmpty() {
        return stack.isEmpty();
    }

    @Override
    public void push(E element) {
        stack.push(element);
    }

    @Override
    public E pop() {
        return stack.pop();
    }

    @Override
    public E peak() {
        return stack.peek();
    }
}
